package 洛谷;

import java.util.Scanner;

/**
 * @author ZhuYi
 * @create 2025/4/10 12:41
 */
public class 好数 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int cnt = 0;
        for (int i = 1; i <= N; i++) {
            if (check(i)) {
                cnt++;
            }
        }
        System.out.println(cnt);

    }

    static boolean check(int i) {
        String s = String.valueOf(i);
        int len = s.length();
        int[] arr = new int[len + 1];
        for (int m = 1; m <= len; m++) {
            arr[m] = i % 10;
            i /= 10;
        }
        for (int j = 1; j <= len; j++) {
            if (j % 2 == 0) {
                if (arr[j] % 2 != 0) {
                    return false;
                }
            } else {
                if (arr[j] % 2 == 0) {
                    return false;
                }
            }
        }
        return true;
    }
}
